#define DEBUG
#include <cstdio>

using namespace std;

const int maxn=50000, maxm=100000;

int min(int a, int b) {
	return a<b ? a : b;
}

class Graph {
	public:
		int n, m=1, ind[maxn+1], link[2*maxm+1], to[2*maxm+1], low[maxn+1], dfn[maxn+1], size[maxn+1], rsize[maxn+1];
		bool node[maxn+1];

		void addSide(int u, int v) {
			m++;
			to[m] = v;
			link[m] = ind[u];
			ind[u] = m;
		}

		void tarjan(int o, int fa, int ans[]) {
			low[o] = dfn[o] = ++dfn[0];
			size[o] = 1;
			for (int i=ind[o]; i; i=link[i]) {
				if (to[i]!=fa) {
					if (!dfn[to[i]]) {
						tarjan(to[i], o, ans);
						low[o] = min(low[o], low[to[i]]);
						size[o] += size[to[i]];
					} else {
						low[o] = min(low[o], dfn[to[i]]);
					}
				}
			}
			if (low[o]>=dfn[fa]) {
				node[fa] = true;
				rsize[fa] += size[o];
				ans[fa] += (n-size[o]-1)*size[o];
			}
			if (node[o]) {
				ans[o] += (n-rsize[o]-1)*rsize[o];
			}
		}
};

int main() {
#ifdef DEBUG
	freopen("src.in", "r", stdin);
	freopen("src.out", "w", stdout);
#endif

	static Graph g;
	int n, m;
	scanf("%d %d", &n, &m);
	g.n = n;
	for (int i=1; i<=m; i++) {
		int u, v;
		scanf("%d %d", &u, &v);
		g.addSide(u, v);
		g.addSide(v, u);
	}

	static int ans[maxn+1];
	g.tarjan(1, 0, ans);
	for (int i=1; i<=n; i++) {
		printf("%d\n", ans[i]/2+n-1);
	}

	fclose(stdin);
	fclose(stdout);
	return 0;
}
